import java.math.BigInteger;
import java.util.*;

public class Solution {
    public static long MaxSubSequence(String[] array){
        int length=array.length;
        long maxSum=Integer.MIN_VALUE;
        long thisSum=0;
        for(int i=0;i<length;i++){
            thisSum+=Integer.valueOf(array[i]);
            if(thisSum>maxSum){
                maxSum=thisSum;
            }
            else if(thisSum<0){
                thisSum=0;
            }
        }
        return maxSum;
    }
    public static void main(String args[]){
        Scanner in = new Scanner(System.in);
        String[] a = in.nextLine().trim().split(" ");
        long b = MaxSubSequence(a);
        System.out.println(b);
    }

}

